﻿using CoreShop.Library;
using Sunny.UI;
using System;
using System.Drawing;

namespace CoreShop.App
{
    public partial class UIGoodsPagination : UIUserControl
    {
        public UIGoodsPagination()
        {
            InitializeComponent();
        }

        private bool showFoodImg;
        public bool ShowFoodImg
        {
            get { return showFoodImg; }
            set
            {
                Width = value == false ? 133 : 202;
                this.btnFoodPre.Width = CommFunc.ConvertToInt32(Math.Floor((decimal)Width / 2));
                this.btnFoodNext.Width = this.btnFoodPre.Width;
                Invalidate();
            }
        }

        private bool btnFoodPreState;
        public bool BtnFoodPreState
        {
            get { return btnFoodPreState; }
            set
            {
                this.btnFoodPre.Enabled = value;
                Invalidate();
            }
        }


        private bool btnFoodNextState;
        public bool BtnFoodNextState
        {
            get { return btnFoodNextState; }
            set
            {
                this.btnFoodNext.Enabled = value;
                Invalidate();
            }
        }

        public event EventHandler SetFoodListPre;
        public event EventHandler SetFoodListNext;
        
        private void btnListPre_Click(object sender, EventArgs e)
        {
            SetFoodListPre?.Invoke(this, e);
        }

        private void btnListNext_Click(object sender, EventArgs e)
        {
            SetFoodListNext?.Invoke(this, e);
        }
    }
}
